package com.mszlu.blog.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mszlu.blog.common.Result;
import com.mszlu.blog.entity.Comment;
import com.mszlu.blog.entity.SysUser;
import com.mszlu.blog.entity.dto.CommentDto;
import com.mszlu.blog.service.CommentService;
import com.mszlu.blog.service.SysUserServive;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.stream.Collectors;

@Slf4j
@RestController
@RequestMapping("/comments")
public class CommentController {

    @Autowired
    private CommentService commentService;

    @GetMapping("/article/{id}")
    public Result articleComments(@PathVariable Long id){

        return commentService.viewsById(id);

    }

    @PostMapping("/create/change")
    public Result comment(@RequestBody Comment comment){

        return commentService.comment(comment);
    }



}
